#ifndef SEARCHDIALOG_H
#define SEARCHDIALOG_H

#include <QDialog>
#include "yrmainwindow.h"
#include "ui_yrmainwindow.h"

class YRMainWindow;
namespace Ui {
class SearchDialog;
}

class SearchDialog : public QDialog
{
    Q_OBJECT

public:
    SearchDialog(QSqlDatabase& db, YRMainWindow *parent = nullptr);
    ~SearchDialog();

private slots:
    void on_pushButton_A_clicked();

    void on_pushButton_B_clicked();

private:
    Ui::SearchDialog *ui;
    YRMainWindow *mainWindow; // 添加mainWindow作为成员变量
    QSqlDatabase& yrDatabase; // 引用传递数据库对象

    void init();
    void cleanAll();
    int countCheckedItems() const;
    void updateCheckBoxStates();
    void onCheckBoxStateChanged();
};

#endif // SEARCHDIALOG_H
